﻿<Button Icon="fa fa-fa" Text="弹窗" Color="Color.Success" OnClick="@ShowButtons" />

@code {
    private Task ShowButtons()
    {
        var op = new SwalOption()
        {
            Category = SwalCategory.Success,
            Title = "我是 Title",
            Content = "我是 Content",
            ShowClose = false
        };
        op.ButtonTemplate = new RenderFragment(builder =>
        {
            builder.OpenComponent<Button>(0);
            builder.AddAttribute(1, nameof(Button.Text), "自定义关闭按钮");
            builder.AddAttribute(2, nameof(Button.OnClick), EventCallback.Factory.Create<MouseEventArgs>(this, async () => await op.Close()));
            builder.CloseComponent();
        });
        SwalService.Show(op);
        return Task.CompletedTask;
    }
}
